home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / editor / auror300.zip / FLSAVE.AML < prev    next >
Text File  |  1996-07-17  |  2KB  |  68 lines

  1. //--------------------------------------------------------------------
  2. // FLSAVE.AML
  3. // Save File List, (C) 1993-1996 by nuText Systems
  4. //
  5. // This macro copies file/directory names from the current file manager
  6. // window to a new buffer. The names will be fully qualified.
  7. //
  8. // If option 'e' is specified as arg 3, then the buffer is displayed in
  9. // a new edit window, otherwise the user is prompted for a filename
  10. // where the buffer should be saved.
  11. //
  12. // Usage:
  13. //
  14. // This macro can be run by selecting Save List As or Edit List from
  15. // the file manager File menu.
  16. //--------------------------------------------------------------------
  17.  
  18. // compile time macros and function definitions
  19. include bootpath "define.aml"
  20.  
  21. // fmgr windows only
  22. if not wintype? "fmgr" then
  23.   msgbox "File Manager windows only!"
  24.   return
  25. end
  26.  
  27. // get fmgr buffer id and name
  28. fbuffer = getcurrbuf
  29. bufname = getbufname
  30.  
  31. // format fmgr buffer name (for fgetfile below)
  32. setbufname (onname bufname)
  33.  
  34. // create edit buffer
  35. buffer = createbuf
  36.  
  37. // copy fmgr list to an edit buffer
  38. gotobuf fbuffer
  39. pushcursor
  40. row 1
  41. repeat
  42.   addline (fgetfile) '' '' buffer
  43. until not down
  44. popcursor
  45.  
  46. // restore fmgr buffer name
  47. setbufname bufname fbuffer
  48.  
  49. // delete first line and parent directory line
  50. currbuf buffer
  51. delline
  52. if getlinelen <= length (getpath bufname) then
  53.   delline
  54. end
  55.  
  56. // edit list
  57. if pos 'e' (arg 3) then
  58.   // display the edit buffer in a window
  59.   setbufname (qualify "temp.txt" bufname)
  60.   openbuf buffer
  61.  
  62. // save list
  63. else
  64.   setbufname bufname
  65.   asksaveas '' bufname "lst"
  66.   destroybuf buffer
  67. end
  68.